package com.study.demo_cache_ehcache.service;

import com.study.demo_cache_ehcache.bean.User;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @ClassName: UserService
 * @Description:
 * @author: WS
 * @date 2020/12/26
 * @Version: 1.0
 **/
@Service
public class UserService {
    @Cacheable(cacheNames = "myCache")
    public User getUserById(Integer id){
        System.out.println("UserService.getUserById>>>"+id);
        User user = new User();
        user.setId(id);
        return user;
    }
}
